package cn.iocoder.yudao.module.diy.dal.mysql.route;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.diy.dal.dataobject.route.RouteDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.diy.controller.admin.route.vo.*;

/**
 * 装修自定义路由 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface RouteMapper extends BaseMapperX<RouteDO> {

    default PageResult<RouteDO> selectPage(RoutePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RouteDO>()
                .eqIfPresent(RouteDO::getAddonId, reqVO.getAddonId())
                .eqIfPresent(RouteDO::getTitle, reqVO.getTitle())
                .likeIfPresent(RouteDO::getRouteName, reqVO.getRouteName())
                .eqIfPresent(RouteDO::getPage, reqVO.getPage())
                .eqIfPresent(RouteDO::getShare, reqVO.getShare())
                .eqIfPresent(RouteDO::getIsShare, reqVO.getIsShare())
                .eqIfPresent(RouteDO::getSort, reqVO.getSort())
                .betweenIfPresent(RouteDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RouteDO::getId));
    }

}